import { TableColumnObject } from 'amis/lib/renderers/Table'
import serverColumnUtils, { ServerColumnUtilsProps } from '@/components/amis/ServerColumnUtils/serverColumnUtils'
import captchaSmsApplicationAdminService from '@/core/captchaSms/generated/service/admin/captchaSmsApplicationAdminService'

class CaptchaSmsAppIdColumnUtils {
	getSchema = (parmas?: Partial<TableColumnObject>): TableColumnObject => {
		const mergeSchema = Object.assign(
			{
				name: 'captchaSmsAppId',
				label: '短信验证码应用',
				labelField: 'title',
				valueField: 'id',
				getByIdsWithDebounce: captchaSmsApplicationAdminService.getByIdsWithDebounce,
			},
			parmas,
		) as ServerColumnUtilsProps
		const schema = serverColumnUtils.getSchema(mergeSchema)
		return schema as TableColumnObject
	}
}

export default new CaptchaSmsAppIdColumnUtils()
